package com.whfc.fvs.service.factroy;

import com.whfc.fvs.enums.VsPlatform;
import com.whfc.fvs.service.FvsPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 视频监控平台工厂类
 *
 * @author qzexing
 * @version 1.0
 * @date 2020/4/29 22:41
 */
@Component
public class FvsPlatformServiceFactory {

    @Autowired
    private final Map<String, FvsPlatformService> serviceMap = new ConcurrentHashMap<>();


    public FvsPlatformService getFvsPlatFromService(VsPlatform platform) {
        switch (platform) {
            case HIK_EZVIZ:
                return serviceMap.get(FvsPlatformConstant.EZVIZ_SERVICE);
            case DAHUA_IMOU:
                return serviceMap.get(FvsPlatformConstant.IMOU_SERVICE);
            case ALIYUN_GB28181:
                return serviceMap.get(FvsPlatformConstant.ALIYUN_GB28181_SERVICE);
            case ALIYUN_RTMP:
                return serviceMap.get(FvsPlatformConstant.ALIYUN_RTMP_SERVICE);
            case LIVE_URL_PLAY:
                return serviceMap.get(FvsPlatformConstant.LIVE_URL_PLAY_SERVICE);
            case STREAM_SERVER:
                return serviceMap.get(FvsPlatformConstant.STREAM_SERVER_SERVICE);
            case EZVIZ_GB28181:
                return serviceMap.get(FvsPlatformConstant.EZVIZ_GB24181_SERVICE);
            case UNI:
                return serviceMap.get(FvsPlatformConstant.UNI_SERVER_SERVICE);
            default:
                return null;
        }
    }

}
